package com.jvyou.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @author 橘柚
 * @version 1.0-SNAPSHOT
 * @Date 2024/7/17 16:26
 * @Description 测试更新
 */
public class UpdateDemo {

    public static void main(String[] args) throws SQLException {
        String url = "jdbc:mysql://localhost:3306/jvyou-mybatis";
        String username = "root";
        String password = "123456";
        Connection connection = DriverManager.getConnection(url, username, password);
        PreparedStatement psm = connection.prepareStatement("insert into user values (?,?,?,?)");
        psm.setInt(1, 1001);
        psm.setString(2, "jvyou");
        psm.setString(3, "123456");
        psm.setString(4, "jvyou@jvyou.com");
        psm.executeUpdate();
        psm.close();
        connection.close();
    }
}
